package ThreadDemo;

public class TreadDemo3 {
    private static boolean judge=true;
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(new Runnable() {

            @Override
            public void run() {
                while (judge){
                    System.out.println("我在忙着转账");
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        thread.start();
        Thread.sleep(5000);
        judge=false;
        System.out.println("有内鬼终止交易");
    }
}
